// using System;
// using System.IO;
// using System.Threading;
// using System.Threading.Tasks;
// using Microsoft.CodeAnalysis;
// using Microsoft.CodeAnalysis.Text;

// namespace OmniSharp
// {

//     //注意：原实现从文件加载代码，现改为从DesignNode加载

//     public class OmniSharpTextLoader : TextLoader
//     {
//         private readonly string _filePath;

//         public OmniSharpTextLoader(string filePath)
//         {
//             if (filePath == null)
//             {
//                 throw new ArgumentNullException(nameof(filePath));
//             }

//             if (!Path.IsPathRooted(filePath))
//             {
//                 throw new ArgumentException("Expected an absolute file path", nameof(filePath));
//             }

//             this._filePath = filePath;
//         }

//         public override Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
//         {
//             var prevLastWriteTime = File.GetLastWriteTimeUtc(_filePath);

//             TextAndVersion textAndVersion;

//             using (var stream = File.OpenRead(_filePath))
//             {
//                 var version = VersionStamp.Create(prevLastWriteTime);
//                 var text = SourceText.From(stream);
//                 textAndVersion = TextAndVersion.Create(text, version, _filePath);
//             }

//             var newLastWriteTime = File.GetLastWriteTimeUtc(_filePath);
//             if (!newLastWriteTime.Equals(prevLastWriteTime))
//             {
//                 throw new IOException($"File was externally modified: {_filePath}");
//             }

//             return Task.FromResult(textAndVersion);
//         }
//     }
// }
